package com.scjp_Java6.String;

public class UserProfile {

	public static void main(String[] args) {
		String s = "<userprofile><username>johndoe</username><charactername>john_the_great</charactername><look><clothing>green</clothing><hair>red</hair></look><strength>speed</strength><items>sword,armor</items><date>2012-11-20</date></userprofile>";

		int endIndex1 = s.indexOf(">");
		s = s.substring(endIndex1 + 1);

		System.out.println("tag: " + s);

		int startIndex = s.indexOf("<");
		int endIndex = s.indexOf(">");
		int endOfTag = s.indexOf("</");

		System.out.println(endOfTag);

		String tag = s.substring(startIndex + 1, endIndex);
		System.out.println("Tag " + tag);
		s = s.substring(endIndex + 1);
		System.out.println(s);
		String value = s.substring(0, startIndex);
		System.out.println("Value: " + value);
		
		s=s.substring(0,startIndex);
		System.out.println(s);
		
		

		
		
	}

}
